package com.tarena.day03_all;

import java.util.Scanner;

public class AdditionalSum {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入该数字的位数：");
		int num = sc.nextInt();
		long last = 0;
		long total = 0;
		for(int i = 0; i < num; i++){
			last *= 10;
			last += 9;
			total += last;
		}
		System.out.println("last = " + last);
		System.out.println("前n项的和是：" + total);
	}
}
